package cn.driver.reserve.service.impl;

import cn.driver.common.pojo.Reserve;
import cn.driver.reserve.mapper.ReserveMapper;
import cn.driver.reserve.service.ReserveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReserveServiceImpl implements ReserveService {
    @Autowired
    private ReserveMapper mapper;

    @Override
    public boolean insertNewReserve(Reserve reserve) {
        return mapper.insert(reserve) > 0;
    }

    @Override
    public boolean updateReserve(Reserve reserve) {
        return mapper.update(reserve) > 0;
    }

    @Override
    public boolean changeResStatus(String resId) {
        return mapper.changeStatus(resId) > 0;
    }

    @Override
    public boolean deleteReserve(String resId) {
        return mapper.delete(resId) > 0;
    }

    @Override
    public List<Reserve> getFullReserveList(int index, int pageSize, String resId) {
        return mapper.getReserveList((index - 1) * pageSize, pageSize, resId);
    }

    @Override
    public List<Reserve> getReserveListByCoach(int coaId) {
        return mapper.getReserveListByCoach(coaId);
    }

    @Override
    public Reserve getReserveByStuId(int stuId) {
        return mapper.getReserveByStuId(stuId);
    }

    @Override
    public int getCountByCreateDate(String date) {
        return mapper.getCountByCreateDate(date);
    }

    @Override
    public int getReserveCount() {
        return mapper.getReserveCount();
    }
}
